package test.com.sky.designPattern.statePattern;

import com.sky.JULLog.MyLogger;

import java.util.logging.Logger;

public class StoppingState extends LiftState {


    private Logger log = MyLogger.getLogger(StoppingState.class) ;

    StoppingState(Lift lift) {
        super(lift);
    }

    @Override
    public void open() {
        // 开门动作
        // 1、开门状态
        this.lift.setState(lift.getOpeningState());
        // 2、执行开门动作
        this.lift.open();
    }

    @Override
    public void close() {
        //  throw  exception
        log.severe("停止状态下，不执行关门动作");
    }

    @Override
    public void run() {
        // 运行动作
        // 1、运行状态
        this.lift.setState(lift.getRunningState());
        // 2、运行动作
        this.lift.run();
    }

    @Override
    public void stop() {
        // 电梯停止动作
        log.info("电梯停止运行...");
    }


}
